package io.renren.modules.diycake.controller;

import java.util.Arrays;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.diycake.entity.VedioEntity;
import io.renren.modules.diycake.service.VedioService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author mohan
 * @email 1358665425@qq.com
 * @date 2022-01-09 16:40:26
 */
@RestController
@RequestMapping("diycake/vedio")
public class VedioController {
    @Autowired
    private VedioService vedioService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("diycake:vedio:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = vedioService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("diycake:vedio:info")
    public R info(@PathVariable("id") Integer id){
		VedioEntity vedio = vedioService.getById(id);

        return R.ok().put("vedio", vedio);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("diycake:vedio:save")
    public R save(@RequestBody VedioEntity vedio){
		vedioService.save(vedio);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
   // @RequiresPermissions("diycake:vedio:update")
    public R update(@RequestBody VedioEntity vedio){
		vedioService.updateById(vedio);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("diycake:vedio:delete")
    public R delete(@RequestBody Integer[] ids){
		vedioService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
